<head>
  <meta name="layout" content="main" />
  <title>Cadastrar Profissional</title>
<g:javascript library="jquery"/>
<link rel="stylesheet" href="${createLinkTo(dir:'css',file:'datarel.css')}" />
</head>
<body>



  <div class="body">

<g:ifAnyGranted role="ROLE_ADMIN">

    <h1>Cadastrar Profissional</h1>
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${person}">
      <div class="errors">
        <g:renderErrors bean="${person}" as="list" />
      </div>
    </g:hasErrors>
    <g:form action="save">
      <input type="hidden" name="id" value="${person.id}" />
      <input type="hidden" name="version" value="${person.version}" />
         
              <fieldset><legend>Cadastrar Usuario</legend>

          <table>
            <tbody>
           <tr class="prop odd">
              <td valign="top" class="email">
                <label for="email"><g:message code="usuario.passwd.label" default="Endereço eletrônico" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'email', 'errors')}">
                <input name="email" id="email" type="text" onchange="valida(this.value,this.id);" class="big" value="${person?.email?.encodeAsHTML()}" />
            </td>
            </tr>

            <tr class="prop ">
              <td valign="top" class="email">
                <label for="email2"><g:message code="usuario.email2.label" default="Confirme o endereço eletrônico" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'email2', 'errors')}">
            <input name="email2" id="email2" type="text" onchange="valida(this.value,this.id);" class="big" value="${person?.email2?.encodeAsHTML()}" />
            </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="userRealName">
                <label for="userRealName"><g:message code="usuario.userRealName.label" default="Nome completo" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'userRealName', 'errors')}">

            <input name="userRealName" id="userRealName"  onchange="valida(this.value,this.id);" class="big" value="${person?.userRealName?.encodeAsHTML()}" />
            </td>
            </tr>
            <tr class="prop odd">
              <td valign="top" class="passwd">
                <label for="passwd"><g:message code="usuario.passwd.label" default="Senha de acesso" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'passwd', 'errors')}">

            <input name="passwd" id="passwd" type="password" onchange="valida(this.value,this.id);" class="medium" value="${person?.passwd?.encodeAsHTML()}" />
            </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="pass">
                <label for="pass"><g:message code="usuario.pass.label" default="Confirme senha" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'pass', 'errors')}">
                <input name="pass" id="pass" type="password" onchange="valida(this.value,this.id);" class="medium" value="${person?.pass?.encodeAsHTML()}" />
            </td>
            </tr>

          
            </tbody>
          </table>

</fieldset>
      <div class="space-me"></div>
<fieldset><legend>Permissões</legend>
 <g:ifAnyGranted role="ROLE_ADMIN"  >


      <div class="list">
        <div class="space-me"><!-- spacer --></div>
        
</g:ifAnyGranted>
        <div class="spacer"><!-- spacer --></div>
        <table class="datagrid">
          <col width="10%" />
          <col width="20%" />
          <col width="70%" />
          <thead>
            <tr>
              <th align="center" ></th>
              <th align="center" >ROLE</th>
              <th align="center" >DESCRIS&Atilde;O </th>
            </tr>
          </thead>
          <tbody>
          <g:each in="${authorityList}"  >
            <g:if test="${it.authority != 'ROLE_USER'}" >
            <tr>
              <td> <g:checkBox name="${it.authority}"/> </td>
            <td>${it.authority.encodeAsHTML()}</td>
            <td>${it.description.encodeAsHTML()}
            </td>
            </tr></g:if>
          </g:each>
          </tbody>
        </table>
        </fieldset>

<div class="spacer"></div>
      <div class="buttons">
        <g:submitButton name="create" class="cmd green save"
                        value="Enviar informações" />
      </div>
      <div class="spacer"></div>
      <div class="clear"><!-- clear --></div>
<div class="clear"><!-- clear --></div>
 
</g:form>
    </g:ifAnyGranted>
</div>
</body>
